package io.io.Pra;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class String读写 {
    public static void main(String[] args) throws IOException{
        File file = new File("xx.txt");
//        FileOutputStream fileOutputStream = new FileOutputStream(file);
//        String s="AWFF袁建鹏";
//        byte[] bytes = s.getBytes(StandardCharsets.UTF_8);
//        fileOutputStream.write(bytes);
//        fileOutputStream.close();
        FileInputStream fileInputStream = new FileInputStream(file);
        byte[] bytes = new byte[(int) file.length()];
        fileInputStream.read(bytes);
        String s = new String(bytes, StandardCharsets.UTF_8);
        System.out.println(s);



    }
}
